<include file="Index:header" />
<!-- Content Header (Page header) -->
    <section class="content-header">
      <h1> 更新文章 </h1>
      <ol class="breadcrumb">
        <li><a href="__APP__/TIFAWEB_DSWJCMS.html" class="goindex"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li> 文章管理</li>
        <li><a href="__APP__/TIFAWEB_DSWJCMS/Site/articleList.html"> 文章管理</a></li>
        <li class="active">更新文章</li>
      </ol>
    </section>
<!--主体-->
    <!-- Main content -->
  <section class="content">
 <form method="post"  action='__APP__/TIFAWEB_DSWJCMS/Site/tfUpdasite' enctype="multipart/form-data">
 <input name="user_id" type="hidden" value="{$list['user_id']}" />
  <input name="u"  type="hidden" value="__APP__/TIFAWEB_DSWJCMS/Site/articleList.html" />
  <input name="sid" type="hidden" value="{$list['id']}" />
  <input name="fid" type="hidden" value="{$list['fid']}" />
  <input name="q" id="q" type="hidden" value="art" />
    <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
              <li class="active"><a href="#basic" data-toggle="tab">基本信息</a></li>
              <li><a href="#detailed" data-toggle="tab">详细信息</a></li>
            </ul>
            <div class="tab-content">
              <div class="active tab-pane" id="basic">
              <!--基本信息 --> 
              <table class="table">
                                    <tbody>
                                      <tr>
                                        <td>
                                               文章名称：
                                        </td>
                                        <td>
                                          <input name="title" type="text" class="form-control" value="{$list['title']}" maxlength="30">
                                        </td>
                                      </tr>
                                      <tr>
                                        <td>
                                               文章所属栏目：
                                        </td>
                                        <td>
                                        
                                          <if condition="$site">
                                          
                                          <select id="catid" name="catid" class="form-control">
                                          <option value="{$list.catid}" class="cal{$sites.order}">{$sites.title}</option>
                                          <volist id="vo" name="site">
                                          <option value="{$vo.id}" class="cal{$vo.order}">
                                            <if condition="intval($vo['order']) eq 1 ">
                                               {$vo.title}
                                          
                                           <elseif condition="intval($vo['order']) eq 2 " />
                                            ├ {$vo.title}
                                            <elseif condition="intval($vo['order']) eq 3 " /> 
                                            │├ {$vo.title}
                                            <elseif condition="intval($vo['order']) eq 4 " /> 
                                           ││├ {$vo.title}
                                            <elseif condition="intval($vo['order']) eq 5 " /> 
                                            │││├ {$vo.title}
                                            <else />
                                            │--├ {$vo.title}
                                            </if>
            
                                          </option>
                                          
                                          </volist>
                                          
                                          </select>
                                       
                                          </if>
                                        </td>
                                      </tr>
                 
                                       <tr>
                                        <td>
                                               关键字：
                                        </td>
                                        <td>
                                          <input name="keyword" type="text" class="form-control" value="{$list['keyword']}" maxlength="150">
                                        </td>
                                      </tr>
                              <tr>
                                        <td>
                                               描述：
                                        </td>
                                        <td>
                                          <textarea name="remark" class="form-control"  maxlength="200" style="height:200px;">{$list['remark']}</textarea>
                                        </td>
                                      </tr>
  
                                       <tr>
                                        <td>
                                               是否发布：
                                        </td>
                                        <td class="form-group">
                                         <if condition="intval($list['published']) eq 1">
                                          <label><input type="radio" name="published" value="0"  class="minimal"/> 暂不发布</label>
                                          <label><input type="radio" name="published" value="1" class="minimal" checked/> 发布</label>
                                         <else />
                                       		<label><input type="radio" name="published" value="0" class="minimal" checked/> 暂不发布</label>
                                          <label><input type="radio" name="published" value="1" class="minimal" /> 发布</label>                                         
                                         </if>
                                        </td>
                                      </tr>  
                                      <tr>
                                        <td>
                                               排序：
                                        </td>
                                        <td>
                                          <input name="order" type="text" class="form-control"  value="{$list['order']}">
                                        </td>
                                      </tr>
                                    </tbody>
                
                    </table>

                      <input name="modified" type="hidden" value="{$list['modified']}" />
                      <input name="modified_by" type="hidden" value="{$Think.session.admin_name}" />
              <!--基本信息 end--> 
              </div>
              <div class="tab-pane" id="detailed">
              <!--详细信息 --> 
              <table class="table">
               <tbody>
                <tr>
                  <td>
                         缩略图：
                  </td>
                  <td>
                  	<if condition="$list.litpic neq ''">
                  	<div class="imgupload"  id="fileList"  style="width:202px;height:102px;">
                    <input name="litpic" type="hidden" value="{$list.litpic}" />
                    <img src="__PUBLIC__/uploadify/uploads/site/{$list.litpic}" style="width:200px;height:100px;"/>
                    </div>
                      <else/>
                        <div class="imgupload"  id="fileList"  style="width:202px;height:102px;">
                        <span class="fa fa-plus"></span>
                        </div>
                      </if>
                    <input name="input" type="file" id="fileElem" multiple accept="image/*"  onchange="handleFiles(this)" class="hide">	
                  
                  </td>
                </tr>  
                                   
               
                <tr>
                  <td>
                         内容：
                  </td>
                  <td>
                      <textarea class="editor" name="introtext" style="width:100%;height:400px;">{$list.introtext}</textarea>  
                  </td>
                </tr>
                </tbody>
                </table>
              <!--详细信息 end--> 
              </div>
             
            </div>
            <!-- /.tab-content -->
          </div>
          <!-- /.nav-tabs-custom -->
    <div class="row">
     <button class="btn btn-primary pull-right" style="margin-right: 15px;"  type="submit">
                  提交
              </button>
    </div>
    </form>
    
  </section>
<include file="Index:footer" />

<script>
//上级类目处理
function setCatPid(v){
		 var catpid  = $(v).attr("catpid");
		 var order =  $(v).attr("order");
		 var pid  = $(v).attr("value");
		 $("#catpid").attr("value",catpid);
	 }
//图片上传处理
window.URL = window.URL || window.webkitURL;
    var fileElem = document.getElementById("fileElem"),
    fileList = document.getElementById("fileList");
	fileList.addEventListener('click',function(){
		fileElem.click();
	},false);
    function handleFiles(obj) {
        var files = obj.files,
        img = new Image();
        if(window.URL){
            //File API
            //alert(files[0].name + "," + files[0].size + " bytes");
            img.src = window.URL.createObjectURL(files[0]); //创建一个object URL，并不是你的本地路径
            img.onload = function(e) {
                window.URL.revokeObjectURL(this.src); //图片加载后，释放object URL
            }
			
            fileList.innerHTML='<img src="'+img.src+'" style="width:200px;height:100px;"/>';
        }else if(window.FileReader){
            //opera不支持createObjectURL/revokeObjectURL方法。我们用FileReader对象来处理
            var reader = new FileReader();
            reader.readAsDataURL(files[0]);
            reader.onload = function(e){
               // alert(files[0].name + "," +e.total + " bytes");
                img.src = this.result;
                img.width = 200;
                 fileList.innerHTML='<img src="'+img.src+'"  style="width:200px;height:100px;"/>';
            }
        }else{
            //ie
            obj.select();
            obj.blur();
            var nfile = document.selection.createRange().text;
            document.selection.empty();
            img.src = nfile;
            img.width = 200;
            img.onload=function(){
                //alert(nfile+","+img.fileSize + " bytes");
            }
            fileList.innerHTML='<img src="'+img.src+'"  style="width:200px;height:100px;"/>';
        }
    }
	
</script>
<!-- editor -->
<script src="__PUBLIC__/editor/kindeditor-min.js"></script>
<script>
	var editor;
	KindEditor.ready(function(K) {
			editor = K.create('.editor');
	});
</script>